package com.heu.blood.analysis.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import com.heu.blood.common.aop.ControllerLogAnnotation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.heu.blood.analysis.entity.BloodSampleInfoInpatientlabEntity;
import com.heu.blood.analysis.service.BloodSampleInfoInpatientlabService;
import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.common.utils.R;



/**
 * 入院检查患者血液样本信息表
 *
 * @author lhh
 * @email lhh1612325771@163.com
 * @date 2023-11-22 15:29:08
 */
@RestController
@RequestMapping("analysis/bloodsampleinfoinpatientlab")
public class BloodSampleInfoInpatientlabController {
    @Autowired
    private BloodSampleInfoInpatientlabService bloodSampleInfoInpatientlabService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ControllerLogAnnotation(module = "入院检查患者血液样本信息", operate = "分页条件查询入院检查患者血液样本信息")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bloodSampleInfoInpatientlabService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @ControllerLogAnnotation(module = "入院检查患者血液样本信息", operate = "根据id查询入院检查患者血液样本信息")
    public R info(@PathVariable("id") Long id){
		BloodSampleInfoInpatientlabEntity bloodSampleInfoInpatientlab = bloodSampleInfoInpatientlabService.getById(id);

        return R.ok().put("data", bloodSampleInfoInpatientlab);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @ControllerLogAnnotation(module = "入院检查患者血液样本信息表", operate = "保存入院检查患者血液样本信息")
    public R save(@RequestBody List<BloodSampleInfoInpatientlabEntity> bloodSampleInfoInpatientlab){
		bloodSampleInfoInpatientlabService.saveBatch(bloodSampleInfoInpatientlab);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @ControllerLogAnnotation(module = "入院检查患者血液样本信息", operate = "更新入院检查患者血液样本信息")
    public R update(@RequestBody BloodSampleInfoInpatientlabEntity bloodSampleInfoInpatientlab){
		bloodSampleInfoInpatientlabService.updateById(bloodSampleInfoInpatientlab);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @ControllerLogAnnotation(module = "入院检查患者血液样本信息", operate = "根据id删除入院检查患者血液样本信息")
    public R delete(@RequestBody Long[] ids){
		bloodSampleInfoInpatientlabService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
